<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different URLs to chosen controllers and their actions (functions).
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;

/**
 * The default class to use for all routes
 *
 * The following route classes are supplied with CakePHP and are appropriate
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass()`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass(DashedRoute::class);

Router::scope('/', function (RouteBuilder $routes) {
    $routes->connect('/', ['controller' => 'Index', 'action' => 'index']);
    $routes->connect('/jobs', ['controller' => 'Index', 'action' => 'jobs']);
    $routes->connect('/school', ['controller' => 'Index', 'action' => 'school']);
    $routes->connect('/zp', ['controller' => 'Index', 'action' => 'zp']);

    // 指定的6个分类
    $routes->connect('/jobs/youeryuan', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/xiaoxue', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/chuzhong', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/gaozhong', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/yuyanpeixun', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/techangpeixun', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据

    // 6个分类的具体详细数据
    $routes->connect('/jobs/youeryuan/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'],['id' => '\d+']); //幼儿园分类所有数据
    $routes->connect('/jobs/xiaoxue/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'],['id' => '\d+']); //幼儿园分类所有数据
    $routes->connect('/jobs/chuzhong/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']); //幼儿园分类所有数据
    $routes->connect('/jobs/gaozhong/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']); //幼儿园分类所有数据
    $routes->connect('/jobs/yuyanpeixun/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']); //幼儿园分类所有数据
    $routes->connect('/jobs/techangpeixun/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']); //幼儿园分类所有数据

    //指定的六个分类，分页数据
    $routes->connect('/jobs/youeryuan/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/xiaoxue/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/chuzhong/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/gaozhong/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/yuyanpeixun/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据
    $routes->connect('/jobs/techangpeixun/p:page.html', ['controller' => 'Index', 'action' => 'assignCate']); //幼儿园分类所有数据


    $routes->connect('/jobs/:bigCate/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']);// 工作详情页
    $routes->connect('/zp/:id.html', ['controller' => 'Index', 'action' => 'zpDetail'], ['id' => '\d+']);//招聘考试 详情页
    $routes->connect('/jobs/:id.html', ['controller' => 'Index', 'action' => 'jobDetail'], ['id' => '\d+']);// 找工作 详情页
    $routes->connect('/school/:id.html', ['controller' => 'Index', 'action' => 'schoolDetail'],
        ['id' => '\d+']);// 找学校详情页

    $routes->connect('/school/p:page.html', ['controller' => 'Index', 'action' => 'school']);// 找学校分页结果
    $routes->connect('/jobs/p:page.html', ['controller' => 'Index', 'action' => 'jobs']);// 找工作分页结果
    $routes->connect('/zp/p:page.html', ['controller' => 'Index', 'action' => 'zp']);//找学校分页结果


    $routes->connect('/school/search/', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果
    $routes->connect('/school/search/', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果分页

    //学校搜索
    $routes->connect('/school/search/:searchWord', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果
    $routes->connect('/school/search/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果
    $routes->connect('/school/search/:provinceName/:searchWord', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果
    $routes->connect('/school/search/:provinceName/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果分页
    $routes->connect('/school/search/:provinceName/:cityName/:searchWord', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果
    $routes->connect('/school/search/:provinceName/:cityName/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'schoolSearch']);//school 搜索结果分页

    //招聘信息搜索
    $routes->connect('/zp/search/:searchWord', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果
    $routes->connect('/zp/search/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果
    $routes->connect('/zp/search/:provinceName/:searchWord', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果
    $routes->connect('/zp/search/:provinceName/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果分页
    $routes->connect('/zp/search/:provinceName/:cityName/:searchWord', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果
    $routes->connect('/zp/search/:provinceName/:cityName/:searchWord/p_:page.html', ['controller' => 'Index', 'action' => 'zpSearch']);//school 搜索结果分页

    $routes->fallbacks(DashedRoute::class);
});

/**
 * Load all plugin routes. See the Plugin documentation on
 * how to customize the loading of plugin routes.
 */
Plugin::routes();
